The COLOR_CONVERT procedure converts colors to and from the RGB (Red Green Blue) and a number of other color spaces.
RGB values are bytes in the range 0 to 255. YCbCr values are bytes with the range indicated below. Other values are in floating point.
These color spaces and their ranges are:
Hue Lightness Saturation (double cone). Also known as HSL and HSI. Hue is measured in degrees between 0 and 360, with 0 corresponding to red, 120 to green, and 240 to blue. Lightness and Saturation are floating-point values between 0 and 1. |
|
Hue Saturation Value (single cone). Hue is measured in degrees between 0 and 360, with 0 corresponding to red, 120 to green, and 240 to blue. Saturation and Value are floating-point values between 0 and 1. |
|
Luminance and two Chrominance. Y is a floating-point value between 0 and 1, U is a floating-point value between -0.436 and 0.436, V is a floating-point value between -0.615 and 0.615. |
|
Luminance In-phase Quadrature. Y is a floating-point value between 0 and 1, I is a floating-point value between -0.596 and 0.596, Q is a floating-point value between -0.523 and 0.523. |
|
Luma ChromaBlue ChromaRed (analog). Y is a floating-point value between 0 and 1, Pb and Pr are floating-point values between -0.5 to 0.5. |
|
Luma ChromaBlue ChromaRed (digital). Y is a floating-point value between 16 and 235, Cb and Cr are floating-point values between 16 and 240. |
The input parameters may be of one of the following forms:
A reference containing a discussion of the various color systems is: Foley and Van Dam, Fundamentals of Interactive Computer Graphics, Addison-Wesley Publishing Co., 1982.
COLOR_CONVERT, I0, I1, I2, O0, O1, O2 [, /HLS_RGB | , /HSV_RGB | , /RGB_HLS | , /RGB_HSV | , /RGB_YCBCR | , /RGB_YIQ | , /RGB_YPBPR | , /RGB_YUV | , /YCBCR_RGB | , /YIQ_RGB | , /YPBPR_RGB | , /YUV_RGB ] [, INTERLEAVE=value]
or
COLOR_CONVERT, I0, O0 [, /HLS_RGB | , /HSV_RGB | , /RGB_HLS | , /RGB_HSV | , /RGB_YCBCR | , /RGB_YIQ | , /RGB_YPBPR | , /RGB_YUV | , /YCBCR_RGB | , /YIQ_RGB | , /YPBPR_RGB | , /YUV_RGB ] [, INTERLEAVE=value]
The input color triple(s). These arguments may be either scalars or arrays of same length.
The variables to receive the result. Their structure is copied from the input parameters.
An input image array of the form 3 x m x n, m x 3 x n, or m x n x 3.
A variable to receive the result. Its structure is copied from the input parameter, I0.
Set this keyword to convert from HLS to RGB.
Set this keyword to convert from HSV to RGB.
This keyword is useful only when calling this procedure with two arguments. It is ignored when using six arguments. Set the keyword to the value that corresponds to the image array's interleave format. The second output argument uses the same interleave format when returning the result. The valid values for 2D arrays (3 x n or n x 3) are:
value |
array type |
0 |
Pixel Interleave (3 x n) (default) |
1 |
Row Interleave (n x 3) |
The valid values for 3D arrays (3xmxn, mx3xn, or mxnx3) are:
value |
array type |
0 |
Pixel Interleave (3 x m x n) (default) |
1 |
Row Interleave (m x 3 x n) |
2 |
Planar Interleave (m x n x 3) |
Set this keyword to convert from RGB to HLS.
Set this keyword to convert from RGB to HSV.
Set this keyword to convert from RGB to YCbCr.
Set this keyword to convert from RGB to YIQ.
Set this keyword to convert from RGB to YPbPr.
Set this keyword to convert from RGB to YUV.
Set this keyword to convert from YCbCr to RGB.
Set this keyword to convert from YIQ to RGB.
Set this keyword to convert from YPbPr to RGB.
Set this keyword to convert from YUV to RGB.
The command:
COLOR_CONVERT, 255, 255, 0, h, s, v, /RGB_HSV
converts the RGB color triple (255, 255, 0), which is the color yellow at full intensity and saturation, to the HSV system. The resulting hue in the variable h is 60.0 degrees. The saturation and value in the variables s and v, are set to 1.0.
The command:
COLOR_CONVERT, rgb_image, yuv_image, /RGB_YUV
converts the RGB_IMAGE image array of the form [3,m,n] to YUV_IMAGE, an image array of the same form.
Pre 4.0 |
Introduced |
6.4 |
Added image array conversion and YUV, YIQ, YPbPr, and YCbCr color spaces |
CMYK_CONVERT, HLS , HSV